# -----------------------------------------------
# Author: yuz
# Copyright: 湖南零檬信息技术有限公司
# Email: wagyu2016@163.com
# Phone&Wechat: 18173179913
# Site: http://www.lemonban.com
# Forum: http://testingpai.com
# -----------------------------------------------
import requests


def login_with_session():
    """cookie 用这种方式"""
    s = requests.Session()
    login_url = 'https://v4.ketangpai.com/UserApi/login'
    data = {
        "email": "wagyu2016@163.com",
        "password": "admin123456",
        "remember": "0"
    }
    s.post(login_url, data)

    user_url = 'https://v4.ketangpai.com/UserApi/getUserInfo'
    r = s.get(user_url)
    print(r.text)


def login_with_session1():
    # s = requests.Session()
    login_url = 'https://v4.ketangpai.com/UserApi/login'
    data = {
        "email": "wagyu2016@163.com",
        "password": "admin123456",
        "remember": "0"
    }
    requests.post(login_url, data)

    user_url = 'https://v4.ketangpai.com/UserApi/getUserInfo'
    r = requests.get(user_url)
    print(r.json())


login_with_session1()